
/*
         文件的输入输出
*/

package ScalaStudy.chapter02

import java.io.{File, PrintWriter}
import scala.io.Source

object Test06_FileIO {
  def main(args: Array[String]): Unit = {
    //（1）从文件中读取数据
    Source.fromFile("src/main/scala/ScalaStudy/chapter02/test.txt").foreach(print)

    //（2）将数据写入文件
    val writer = new PrintWriter(new File("src/main/scala/ScalaStudy/chapter02/outputtest.txt"))
    writer.write("hi,my name is wq")
    writer.close()
  }
}
